<%@page import="com.serviceprovider.business.utility.ApplicationConfigProperties"%>
<%@ page import="net.tanesha.recaptcha.ReCaptcha"%>
<%@ page import="net.tanesha.recaptcha.ReCaptchaFactory"%>
<%@include file="/WEB-INF/taglibs/common/taglibs.jsp" %>

<head>
	<title><spring:message code="registration.title" /></title>
	<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
	<link  rel="stylesheet" href="<c:url value="/css/styles.css"/>"/>
	<script src="<c:url value="/javascripts/common.js"/>" ></script>
	<script>
		function validateForm(){
			var password = document.getElementById("password").value;
			var confirmedPassword = document.getElementById("confirmPassword").value;
			if (password != confirmedPassword){
				  document.getElementById("confirmPasswordError").style.display = "inline";
			    return false;
			}
			return true;
		}
	</script>	
</head>
<body>
<form:form commandName="user" method="POST" onsubmit="return validateForm();">
	<div class="contentArea">
		<table align="center">
			<tr>
				<td colspan="2" align="center">
					<b><spring:message code="registration.title" /></b>
					<br/>
					<br/>
				</td>
			</tr>
		    <tr>
		        <td width="110px"><fmt:message key="registration.firstname" /></td>
		        <td>
		            <form:input path="firstName" cssClass="formField"/>		            
		        </td>
		        <td>
		        	<form:errors path="firstName" cssClass="errors" />
		        </td>
		    </tr>
		    <tr>
		        <td><fmt:message key="registration.middlename" /></td>
		        <td>
		            <form:input path="milddleName" cssClass="formField"/>
		        </td>
		    </tr>
		    <tr>
		        <td><fmt:message key="registration.lastname" /></td>
		        <td>
		            <form:input path="lastName" cssClass="formField"/>
		        </td>
		        <td>
		        	<form:errors path="lastName" cssClass="errors" />
		        </td>
		    </tr>
		    <tr>
		        <td><fmt:message key="registration.email1" /></td>
		        <td>
		            <form:input path="email" cssClass="formField"/>
		        </td>
		        <td>
		        	<form:errors path="email" cssClass="errors" />
		        </td>		        
		    </tr>
		    <tr>
		        <td><fmt:message key="registration.email2" /></td>
		        <td>
		            <form:input path="alternateEmail" cssClass="formField"/>
		        </td>
		    </tr>
		    <tr>
		        <td><fmt:message key="registration.password" /></td>
		        <td>
		        	<form:password path="password" cssClass="formField"/>
		        </td>
		        <td>
		        	<form:errors path="password"  cssClass="errors" />
		        </td>		        
		    </tr>
		    <tr>
		        <td><fmt:message key="registration.repeat_password" /></td>
		        <td>
		            <form:password path="confirmPassword" cssClass="formField"/>
		        </td>
		        <td>
		        	<span><label id="confirmPasswordError" class="errors" style="display: none;"><fmt:message key="registration.validation.dismatch_password" /></label></span>
		        </td>
		    </tr>
		    <tr>
		        <td><fmt:message key="registration.ssn" /></td>
		        <td>
		        	<form:input path="ssn" cssClass="formField"/>
		        </td>
		        <td>
		        	<form:errors path="ssn"  cssClass="errors" />
		        </td>		        
		    </tr>		    
		    <tr>
		        <td colspan="2">
		        	<c:out escapeXml="false" value="${captcha}" />
		        </td>
		        <td>
		        	<c:if test="${captchaError}">
		        		<span><label class="errors"><fmt:message key="registration.validation.captcha_error" /></label></span>
		        	</c:if>
		        </td>
		    </tr>
		    <tr>
		        <td colspan="2" align="center">
		            <br/>
		            <input type="submit" value='<spring:message code="registration.button.register" />' />
		        </td>
		    </tr>
		</table>
	</div>
</form:form>
<%@include file="/WEB-INF/jsp/include/footer.jsp"%>
</body>